<?php
//From: http://fr.php.net/manual/fr/function.scandir.php#90628

//NNNIIIinnnjaaa::
//array of files without directories... optionally filtered by extension
function file_list($d,$x = null){
		$l =array();
       foreach(array_diff(scandir($d),array('.','..')) as $f)if(is_file($d.'/'.$f)&&(($x)?ereg($x.'$',$f):1))$l[]=$f;
       return $l;
}

//NNNIIIinnnjaaa::
//array of directories
function dir_list($d){
		$l=array();
       foreach(array_diff(scandir($d),array('.','..')) as $f)if(is_dir($d.'/'.$f))$l[]=$f;
       return $l;
}
